#coding=utf-8
import mysql_connect
# 进行数据库查询salt加密后的密码
def password(mobile):
    connect = mysql_connect.mysql_connect()[0]  # connect是由connect_mysql函数返回的第一个值
    cursor = connect.cursor()
    # SQL 查询语句
    sql = "SELECT password from gdgyun_community.employee WHERE mobile ="+mobile
    sql_id = "SELECT id from gdgyun_community.employee WHERE mobile =" + mobile
    # 执行sql语句
    cursor.execute(sql)
    result = cursor.fetchall()
    connect.commit()  # 实例提交命令
    password = str(result[0][0])
    # 执行sql语句
    cursor.execute(sql_id)
    id = cursor.fetchall()
    connect.commit()  # 实例提交命令
    user_id = str(id[0][0])
    return password,user_id   #返回密码和user_id

if __name__ == '__main__':
    password('17781108472')